﻿@using System.Linq
@using MrCMS.Helpers
@model System.Collections.Generic.List<MrCMS.Models.SortItem>
@{ Layout = "~/Areas/Admin/Views/Shared/_LayoutPopup.cshtml";}


@using (Html.BeginForm("Sort", "Form", null, FormMethod.Post, new { @class = "form-update-form", id = "sort-fields-form" }))
{
    
    <fieldset>
        <legend>@Resource("Admin Form Sort Fields", "Sort fields")
        <span class="btn-group  display-inline  pull-right">
            <button class="btn btn-primary" id="submit">@Resource("Admin Form Sort Save", "Save & Close")</button>
        </span>
        </legend>

       <ul id="sortable">
            @if (Model.Any())
            {
                for (int i = 0; i < Model.Count; i++)
                {
                <li>
                    @Html.HiddenFor(model => model[i].Id)
                    @Html.HiddenFor(model => model[i].Order)
                    <i class="glyphicon glyphicon-resize-full"></i>&nbsp;&nbsp;
                    @Model[i].Name
                </li>
                }

            }
            else
            {
                <li>@Resource("Admin Form No form fields", "No form field").</li>
            }
        </ul>
    </fieldset>
}
@{ Html.IncludeScript("~/Areas/Admin/Content/Scripts/mrcms/form-sort.js");}